package com.lsk.mps.backend.mapper;

import com.lsk.mps.backend.model.MessageConfirm;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface MessageConfirmMapper {
    @Select("select * from message_confirm where target_message=#{targetID} limit ${offset}, ${rows}")
    List<MessageConfirm> queryConfirms(@Param("targetID") Integer targetID, @Param("offset") Integer offset, @Param("rows") Integer rows);
    @Select("select count(id) from message_confirm where target_message=#{targetID}")
    Integer confirmCount(@Param("targetID") Integer targetID);
    @Select("select confirmer from message_confirm where target_message=#{targetID}")
    List<Integer> queryConfirmers(@Param("targetID") Integer targetID);
    @Insert("insert into message_confirm(content, targetID, confirmer, confirm_date) values(#{content}, #{targetMessage}, #{confirmer}, #{confirmDate})")
    void addMessageConfirm(MessageConfirm messageConfirm);
}
